Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@types/which
Advanced tools
TypeScript definitions for which
The @types/which package provides TypeScript type definitions for the 'which' npm package. 'which' is a utility that locates and returns the path to an executable in the system path, similar to the Unix 'which' command. The @types/which package does not contain functionality itself but provides type definitions to help TypeScript developers use the 'which' package with type safety.
Type definitions for finding an executable in the path
This code sample demonstrates how to use the 'which' package with TypeScript type definitions provided by @types/which. It attempts to locate the 'node' executable in the system path and prints its location or an error if not found.
import which from 'which';
which('node', (err, resolvedPath) => {
if (err) {
console.error('Node executable not found');
return;
}
console.log('Node executable located at:', resolvedPath);
});
find-exec is a package that provides similar functionality to 'which', allowing users to find the path of executables in the system path. Unlike @types/which, find-exec does not require separate type definitions as it may already include TypeScript support or be used in a JavaScript context.
locate-path is another package that helps in finding paths of files or directories based on given criteria. While it serves a broader purpose compared to 'which', it can be used to achieve similar results. It differs from @types/which in that it is not specifically focused on executables and does not provide TypeScript types out of the box.
npm install --save @types/which
This package contains type definitions for which (https://github.com/isaacs/node-which).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which
Additional Details
These definitions were written by vvakame https://github.com/vvakame, and cspotcode https://github.com/cspotcode.
FAQs
TypeScript definitions for which
The npm package @types/which receives a total of 1,030,549 weekly downloads. As such, @types/which popularity was classified as popular.
We found that @types/which demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.